
/**
 * Copyright (C) 2012 Droidhang Inc.
 * All Rights Reserved.
 *
 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Droidhang Inc.
 * The contents of this file may not be disclosed to third parties, copied or
 * duplicated in any form, in whole or in part, without the prior written
 * permission of Droidhang Inc.
 *
 * @author Michael.wang
 *
 */

#include "bigbang.h"
#include "resourcemanager.h"
#include "gamemanager.h"
#include "frameanimation.h"
#include "gamedatamanager.h"
#include "army.h"
#include "unit.h"
#include "gamescene.h"

#define __super         Bullet

BigBangBullet::BigBangBullet(Army *army1, Army *army2, EquipmentAttribute *attr, GameScene *scene) :
__super(attr)
, _army1(army1)
, _army2(army2)
, _gameScene(scene)
{

}

BigBangBullet::~BigBangBullet() {

}

void BigBangBullet::init() {
	auto sprite = CCSkeletalSprite::create("effects_bomb.json");
	sprite->setPosition(ccp(GM->screenSize.width / 2.0f, GM->screenSize.height / 2.0f));
	sprite->playAnimation("play");
	sprite->setLoopCount(1);

	_delay = sprite->getAnimation()->getDuration();

	ManagedGameNodeInfo info;
	info.node = sprite;
	info.nodeType = GameNodeType::skeletal_animation;

	_gameScene->addOneTimeNode(info);
}

bool BigBangBullet::update(float ticks) {
	bool ret = true;

	_delay -= ticks;
	if(_delay <= 0.0f) {
		ret = false;
	}

	return ret;
}
